home *** CD-ROM | disk | FTP | other *** search
/ Suzy B Software 2 / Suzy B Software CD-ROM 2 (1994).iso / extras / falcon / wd2d_pro / sources / direct4d.s < prev    next >
Text File  |  1995-04-27  |  37KB  |  1,867 lines

  1. MOD_BOX=0
  2. MOD_BOX2=1
  3. MOD_HEXA=0
  4. MOD_DECI=1
  5. MOD_WIND=0
  6. MOD_MENU=1
  7. MOD_ACC=0
  8.  
  9. WHO=0    ; 0=wax, 1=gen, 2=roro
  10.  
  11.     ifeq WHO*(WHO-1)
  12.     incdir d:\assemble\sources.wax\direct4d.pro
  13.     endc
  14.     ifeq (WHO-2)
  15.     incdir d:\devpac\source\genuwax\direct4d
  16.     endc
  17.  
  18.     include guw_mac3.s
  19.     include wd2d_pro.hs
  20.     ifeq MOD_ACC
  21.     ifeq WHO*(WHO-1)
  22.     output d:\assemble\sources.wax\direct4d.pro\wd2d_pro.app
  23.     endc
  24.     ifeq (WHO-2)
  25.     output d:\devpac\source\genuwax\direct4d\wd2d_pro.app
  26.     endc
  27.     else
  28.     output c:\wd2d_pro.acc
  29.     endc
  30.  
  31.     ; Direct to disk en lecture
  32.     ; NB buf variable, rattrape le retard, et décompression incluse
  33.     ; module externe utilisable par n'importe quel programme.
  34.     ; Passage de paramètres .TTP, et messages applications GEM.
  35.     ; 24/VII/93  27/VII 30/VII 07/VIII 16/VIII 30/VIII 25/IX
  36.     ; 18/II/94 25/II 02/IV 04/IV 15/IV 23/IV 24/IV, 27/IV
  37.     ; 30/IV 29/V 30/V 1/VI 18/VI 24/VII 5/X 14/X 15/X 16/X 1/XI
  38.     ; 2/XI 5/XI 6/XI 11/XI 13/XI 26/XI 27/XI 4/XII 11/XII
  39.     ; 1/I/94
  40.     ; Gem version : 23/II/1994.
  41.  
  42.     comment HEAD=7
  43.     section TEXT
  44.  
  45. debut:    init_prg 1024,#name_rsc
  46.     move.l a5,command_line
  47.  
  48.     menu_register #-1,#register_name    ; register new name
  49.     shel_write #9,#1,#0,#0,#0    ; reçoit les messages MiNT
  50.  
  51.     clr sample_playing
  52.     clr.l are_there_more
  53.     clr.l play_list_ptr
  54.  
  55.     clr which_clock        ; interne
  56.     clr loop
  57.     clr.l header
  58.     clr replay_in_psst
  59.     move.w #1,which_rout        ; routine par défaut
  60.     move #20,nb_ms        ; 20 ms ps-st
  61.  
  62.     tst acc_app
  63.     bne.s its_an_app
  64.  
  65.     menu_register global+4,#string_acc    ; C 1 ACC
  66.     move d0,acc_number
  67.     bmi fin
  68.  
  69.     bra boucle_gem_principale
  70.  
  71. its_an_app:    tst Mint_present        ; C 1 PRG
  72.     beq.s .no_mint
  73.  
  74.     menu_register global+4,#string_acc    ; C 1 PRG sous Mint
  75.  
  76. .no_mint:
  77.     move #METHOD_1,d0        ; C 1 PRG
  78.     move d0,previous_check2
  79.     moveq #1,d1
  80.     bsr check_menu
  81.  
  82.     move #FREQUENCY_0,d0        ; interne
  83.     moveq #1,d1
  84.     bsr check_menu
  85.  
  86. *    move #FREQUENCY_9,d0
  87. *    move #0,d1
  88. *    bsr grey_menu    
  89.  
  90.     tst copro
  91.     bne.s .is_copro
  92.     move #SPECIAL,d0
  93.     move #0,d1
  94.     bsr grey_menu    
  95. .is_copro:
  96.  
  97.     move.b #freq8,frequency_for_play
  98.     move #FREQUENCY_1,d0
  99.     move d0,previous_check1
  100.     moveq #1,d1
  101.     bsr check_menu
  102.  
  103. *    move #1,loop
  104. *    move #FILES_LOOP,d0
  105. *    moveq #1,d1
  106. *    bsr check_menu
  107.  
  108.     lea original_table_dvswax,a0
  109.     lea table_dvswax,a1
  110.     move #256-1,d0
  111. .default:    move.w (a0)+,(a1)+
  112.     dbf d0,.default
  113.  
  114.     bsr show_menu
  115.  
  116.     move.l command_line,a5
  117.     clr d0
  118.     move.b $80(a5),d0        ; ligne de commande ?
  119.     beq.s boucle_gem_principale
  120.  
  121. *    subq #1,d0            ; pas de sub : recopie le 0
  122.     lea $81(a5),a0
  123.  
  124. *    tst Mint_present
  125. *    beq.s .no_mint2        ; il n'y a forcément qu'un nom si pas mint
  126.  
  127.     move.l #return_more_names,are_there_more
  128.     lea return_more_names,a1
  129. .cp_name:    move.b (a0)+,(a1)+
  130.     dbf d0,.cp_name
  131.     bra ask_selctor
  132.  
  133. *.no_mint2:    lea name_2_load,a1
  134. *.cp_name2:    move.b (a0)+,(a1)+
  135. *    dbf d0,.cp_name2
  136. *    bra load_file2
  137.  
  138.  
  139. boucle_gem_principale:
  140.     clr d0
  141.     tst acc_app
  142.     beq.s .its_acc
  143.     bset #EVNT_KEYBD,d0
  144. .its_acc:    bset #EVNT_MESAG,d0
  145.     bset #EVNT_TIMER,d0
  146.     move #1,d1            ; timer en ms
  147.     bsr traite_evenement_gem
  148.  
  149.     btst #EVNT_KEYBD,d0
  150.     bne keyboard
  151.  
  152.     btst #EVNT_TIMER,d0
  153.     bne.s timer
  154.  
  155.     btst #EVNT_MESAG,d0
  156.     bne message
  157.  
  158.     bra.s boucle_gem_principale
  159.  
  160.  
  161. timer:    tst sample_playing
  162.     beq.s .no
  163.  
  164.     tst end_of_file
  165.     bne.s .wait
  166.  
  167.     bsr check_d2d_load
  168.  
  169. .no    bra boucle_gem_principale
  170.  
  171. .wait:    bsr check_d2d_load
  172.  
  173.     move semaphore,d0
  174.     cmp.w #NBR_BUFF+1,d0        ; on laisse jouer les derniers
  175.     blt boucle_gem_principale
  176.  
  177.     bsr stop_if_running
  178.  
  179.     tst loop
  180.     bne reload_the_same
  181.  
  182.     tst.l are_there_more
  183.     bne load_file
  184.  
  185.     tst.l play_list_ptr
  186.     bne load_file
  187.  
  188.     bra boucle_gem_principale
  189.  
  190. unknown_message:
  191.     neg d1
  192.     cmp.w #AP_TERM,d1        ; AP_TERM
  193.     beq fin
  194.  
  195.     cmp.w #ACC_OPEN,d1        ; ACC_OPEN
  196.     bne.s .not_open_acc
  197.  
  198.     move.w acc_number,d2    ; store the application id
  199.     cmp.w buffer_msg+4*2,d2
  200.     bne boucle_gem_principale
  201.  
  202.     bsr stop_if_running
  203.     clr.l are_there_more
  204.     bra load_file
  205. .not_open_acc:
  206.  
  207.     cmp.w #ACC_CLOSE,d1        ; ACC_CLOSE
  208.     bne.s .not_close_acc
  209.  
  210.     move.w acc_number,d2    ; store the application id
  211.     cmp.w buffer_msg+3*2,d2
  212.     bne boucle_gem_principale
  213.  
  214. *    tst sample_playing
  215. *    beq boucle_gem_principale
  216. *    lea alert_accclose,a0
  217. *    bsr alert_box
  218. *    cmp.w #1,d0
  219. *    beq boucle_gem_principale
  220.  
  221.     bsr stop_if_running
  222.     bra boucle_gem_principale
  223. .not_close_acc:
  224.  
  225.     cmp.w #224,d1        ; on m'a envoyé 1 msg
  226.     beq.s pour_moi
  227.  
  228.     bra boucle_gem_principale
  229.  
  230.  
  231. pour_moi:
  232.     *move buffer_msg+2,d0        ; qui m'a anvoyé ça ?
  233.     move buffer_msg+4,d0
  234.     lea buffer_msg+2*3,a0
  235.     lea store_msg,a1
  236.     move #8-3-1,d1
  237. .cp:    move.w (a0)+,(a1)+
  238.     dbf d1,.cp
  239.  
  240.     lea store_msg+(8-3)*2,a6    ; pointe sur la fin de buffer récep
  241.  
  242.     tst d0
  243.     beq.s .finish
  244.     add.w d0,a6
  245.     save a6
  246.     appl_read global+4,d0,a1
  247.     load a6
  248. .finish:
  249.  
  250.     lea store_msg,a0
  251.  
  252.     cmp.l #'stop',(a0)        ;'stop'
  253.     bne.s .pastop 
  254.     bsr stop_if_running
  255.     bra boucle_gem_principale
  256.  
  257. .pastop:    cmp.l #'play',(a0)
  258.     bne.s .pasplay
  259.  
  260.     lea 4+1(a0),a0        ;'play='
  261.     lea name_2_load,a1
  262. .ccp:    move.b (a0)+,(a1)+
  263.     tst.b -1(a1)
  264.     bne.s .ccp
  265.  
  266.     bra load_file2
  267.  
  268. .pasplay:    cmp.l #'conv',(a0)        ; 'conv=1,name1,name2,name3'
  269.     beq.s conversions
  270.  
  271.     bra boucle_gem_principale
  272.  
  273. conversions:lea 5(a0),a0
  274.  
  275.     cmp.b #'1',(a0)
  276.     bne.s .pas_1
  277.     move #%10,d1        ; 0=read 1=write
  278.     move #2,d2            ; nb. de fich attendus
  279.     lea conv_auto1,a1
  280.     bra .open_them
  281.  
  282. .pas_1:    cmp.b #'2',(a0)
  283.     bne.s .pas_2
  284.     move #%110,d1        ; 0=read 1=write 1=write
  285.     move #3,d2            ; nb. de fich attendus
  286.     lea conv_auto2,a1
  287.     bra .open_them
  288.  
  289. .pas_2:    cmp.b #'3',(a0)
  290.     bne.s .pas_3
  291.     move #%10,d1        ; 0=read 1=write
  292.     move #2,d2            ; nb. de fich attendus
  293.     lea conv_auto3,a1
  294.     bra.s .open_them
  295.  
  296. .pas_3:    cmp.b #'4',(a0)
  297.     bne.s .pas_4
  298.     move #%0,d1            ; 0=read
  299.     move #1,d2            ; nb. de fich attendus
  300.     lea conv_auto4,a1
  301.     bra.s .open_them
  302.  
  303. .pas_4:    cmp.b #'5',(a0)
  304.     bne.s .pas_5
  305.     move #%10,d1        ; 0=read 1=write
  306.     move #2,d2            ; nb. de fich attendus
  307.     lea conv_auto56,a1
  308.     move #1,type_a_sound        ; Stereo Track -> DVS
  309.     bra.s .open_them
  310.  
  311. .pas_5:    cmp.b #'6',(a0)
  312.     bne.s .pas_6
  313.     move #%10,d1        ; 0=read 1=write
  314.     move #2,d2            ; nb. de fich attendus
  315.     lea conv_auto56,a1
  316.     move.w #3,type_a_sound        ; Mono Track -> DVS
  317.     bra.s .open_them
  318.  
  319. .pas_6:    cmp.b #'7',(a0)
  320.     bne.s .pas_7
  321.     move #%10,d1        ; 0=read 1=write
  322.     move #2,d2            ; nb. de fich attendus
  323.     lea conv_auto7,a1
  324.     bra.s .open_them
  325.  
  326. .pas_7:    bra boucle_gem_principale    ; mauvais message ?
  327.  
  328. .open_them:    lea 2(a0),a0        ; "1,"
  329.     lea handle1,a3
  330.     clr.l (a3)
  331.     clr.w 4(a3)            ; pour 'le close'
  332.  
  333. .redo:    move.l a0,a2
  334. .ser:    cmp.b #',',(a2)
  335.     beq.s .found
  336.     addq.l #1,a2
  337.     cmp.l a6,a2
  338.     blt.s .ser
  339.     bra.s .plante
  340.  
  341. .found:    clr.b (a2)+
  342.  
  343.     save d1/d2/a1/a2/a3
  344.     btst #0,d1
  345.     beq.s .zero
  346.     file_open write,(a0)
  347.     bra.s .cont
  348. .zero:    file_open read,(a0)
  349. .cont:    load d1/d2/a1/a2/a3
  350.     move.w d0,(a3)+
  351.     ble.s .plante
  352.  
  353.     move.l a2,a0
  354.     lsr.w #1,d1
  355.     subq #1,d2
  356.     bgt.s .redo
  357.     
  358.     save a1
  359.     bsr stop_if_running
  360.     load a1
  361.     jmp (a1)
  362.  
  363. .plante:    file_close handle3
  364.     file_close handle2
  365.     file_close handle1
  366.     bra boucle_gem_principale
  367.  
  368. ;        --------------------------------
  369.  
  370. keyboard:    lea conversion,a0
  371.     bsr convert_key_in_event
  372.     tst d7
  373.     bne boucle_gem_principale
  374.  
  375. message:    tst d1
  376.     bmi unknown_message
  377.  
  378.     cmp.b #FREQUENCY_1,d1
  379.     bne.s pas_1
  380.     move.b #freq8,frequency_for_play
  381.     move #FREQUENCY_1,d6
  382.     bsr menu_freq_check
  383. pas_1:    cmp.b #FREQUENCY_2,d1
  384.     bne.s pas_2
  385.     move.b #freq10,frequency_for_play
  386.     move #FREQUENCY_2,d6
  387.     bsr menu_freq_check
  388. pas_2:    cmp.b #FREQUENCY_3,d1
  389.     bne.s pas_3
  390.     move.b #freq12,frequency_for_play
  391.     move #FREQUENCY_3,d6
  392.     bsr menu_freq_check
  393. pas_3:    cmp.b #FREQUENCY_4,d1
  394.     bne.s pas_4
  395.     move.b #freq16,frequency_for_play
  396.     move #FREQUENCY_4,d6
  397.     bsr menu_freq_check
  398. pas_4:    cmp.b #FREQUENCY_5,d1
  399.     bne.s pas_5
  400.     move.b #freq20,frequency_for_play
  401.     move #FREQUENCY_5,d6
  402.     bsr menu_freq_check
  403. pas_5:    cmp.b #FREQUENCY_6,d1
  404.     bne.s pas_6
  405.     move.b #freq25,frequency_for_play
  406.     move #FREQUENCY_6,d6
  407.     bsr menu_freq_check
  408. pas_6:    cmp.b #FREQUENCY_7,d1
  409.     bne.s pas_7
  410.     move.b #freq33,frequency_for_play
  411.     move #FREQUENCY_7,d6
  412.     bsr menu_freq_check
  413. pas_7:    cmp.b #FREQUENCY_8,d1
  414.     bne.s pas_8
  415.     move.b #freq49,frequency_for_play
  416.     move #FREQUENCY_8,d6
  417.     bsr menu_freq_check
  418. pas_8:    cmp.b #FREQUENCY_9,d1
  419.     bne.s pas_9
  420.  
  421.     move.w #1,which_clock
  422.     tst sample_playing
  423.     beq.s .not_set
  424.     
  425.     move.w #1,-(sp)        ; no hand shaking
  426.     clr d0
  427.     move.b frequency_for_play,d0
  428.     move.w d0,-(sp)
  429.     move.w which_clock,-(sp)    ; 1=externe
  430.     move.w #8,-(sp)        ; destination : DAC
  431.     move.w #0,-(sp)        ; source : DMA
  432.     appel xbios,139,12
  433. .not_set:    move.w #FREQUENCY_9,d0
  434.     moveq #1,d1
  435.     bsr check_menu
  436.     move.w #FREQUENCY_0,d0
  437.     moveq #0,d1
  438.     bsr check_menu
  439.  
  440. pas_9:    cmp.b #FREQUENCY_0,d1
  441.     bne.s pas_0
  442.  
  443.     move.w #0,which_clock
  444.     tst sample_playing
  445.     beq.s .not_set
  446.     
  447.     move.w #1,-(sp)        ; no hand shaking
  448.     clr d0
  449.     move.b frequency_for_play,d0
  450.     move.w d0,-(sp)
  451.     move.w which_clock,-(sp)    ; 0=interne
  452.     move.w #8,-(sp)        ; destination : DAC
  453.     move.w #0,-(sp)        ; source : DMA
  454.     appel xbios,139,12
  455.  
  456. .not_set:    move.w #FREQUENCY_0,d0
  457.     moveq #1,d1
  458.     bsr check_menu
  459.     move.w #FREQUENCY_9,d0
  460.     moveq #0,d1
  461.     bsr check_menu
  462. pas_0:
  463.  
  464.     tst sample_playing
  465.     bne no_method_change
  466.  
  467.     cmp.b #METHOD_1,d1
  468.     bne.s pas_f1
  469.     bsr check_method
  470.     move.w #1,which_rout
  471. pas_f1:    cmp.b #METHOD_2,d1
  472.     bne.s pas_f2
  473.     bsr check_method
  474.     move.w #2,which_rout    ; 2 & 2bis sont pour le mono 16 bits
  475. pas_f2:    cmp.b #METHOD_3,d1
  476.     bne.s pas_f3
  477.     bsr check_method
  478.     move.w #3,which_rout
  479. pas_f3:
  480. no_method_change:
  481.  
  482.     cmp.b #METHOD_4,d1
  483.     bne.s pas_f4
  484.  
  485.     tst replay_in_psst
  486.     beq.s .ze
  487.     clr replay_in_psst
  488.     bra.s .noze
  489. .ze:    move #1,replay_in_psst
  490. .noze:    move #METHOD_4,d0
  491.     move replay_in_psst,d1
  492.     bsr check_menu
  493. pas_f4:
  494.  
  495.     cmp.w #INFO_MENU,d1
  496.     bne.s .pas1
  497.     move.w #FORM_INFOS,d0
  498.     bsr traite_formulaire
  499.     move.w #DESCRIPTION,d0
  500.     bsr traite_formulaire
  501.     bra boucle_gem_principale
  502.  
  503. .pas1:
  504.     cmp.w #SET_PARAMETER,d1
  505.     bne.s .pas2
  506.  
  507.     move.w #ASK_MILISECONDS,d0
  508.     bsr traite_formulaire
  509.  
  510.     move.w #ASK_MILISECONDS,d0
  511.     lea add_tree,a0
  512.     bsr get_addr_tree
  513.     move.l add_tree,a0
  514.     move.w #VALUE_IN_MS,d0
  515.     bsr get_text_add
  516.     move.l a1,a2    ; sauve pour tester le moins '-'
  517. .next:    tst.b (a1)
  518.     beq.s .pas2
  519.     clr d0
  520.     move.b (a1)+,d0
  521.     cmp.b #'-',d0
  522.     beq.s .next
  523.     sub.b #'0',d0
  524.     tst.b (a1)
  525.     beq.s .stock
  526.     mulu #10,d0
  527.     clr d1
  528.     move.b (a1)+,d1
  529.     sub.b #'0',d1
  530.     add d1,d0
  531.  
  532. .stock:    cmp.b #'-',(a2)
  533.     bne.s .pos
  534.     neg d0
  535. .pos:    cmp #99,d0
  536.     bgt.s .pas2
  537.     cmp #-99,d0
  538.     blt.s .pas2
  539.     move d0,nb_ms
  540.     bra boucle_gem_principale
  541.  
  542. .pas2:
  543.     cmp.w #FILES_QUIT,d1
  544.     beq fin
  545.  
  546.     cmp.w #FILES_STOP,d1
  547.     bne.s .no1
  548.     bsr stop_if_running
  549.     bra boucle_gem_principale
  550. .no1:
  551.     cmp.w #FILES_LOAD,d1
  552.     beq load_file
  553.  
  554.     cmp.w #FILES_LOOP,d1
  555.     beq loop_file
  556.  
  557.     cmp.w #FILES_INFO,d1
  558.     beq show_info_about_a_file    ; infos sur 1 DVS
  559.  
  560.  
  561.     cmp.w #CONVERSION_1,d1        ; stéréo -> mono
  562.     beq conv1
  563.  
  564.     cmp.w #CONVERSION_2,d1        ; stéréo -> G & D
  565.     beq conv2
  566.  
  567.     cmp.w #CONVERSION_3,d1        ; mono -> stéréo
  568.     beq conv3
  569.  
  570.     cmp.w #CONVERSION_4,d1        ; choose compression table
  571.     beq choose_table
  572.  
  573.     cmp.w #CONVERSION_5,d1        ; TRK stéréo -> DVS
  574.     beq conv5
  575.  
  576.     cmp.w #CONVERSION_6,d1        ; TRK mono -> DVS
  577.     beq conv6
  578.  
  579.     cmp.w #CONVERSION_7,d1        ; DVS -> TRK
  580.     beq conv7
  581.  
  582.     cmp.w #CONVERSION_8,d1        ; AVR -> TRK
  583.     beq conv8
  584.  
  585.  
  586.     cmp.w #SPECIAL_ANALYSE,d1
  587.     beq analyse_trk
  588.  
  589.  
  590.     cmp.w #SPECIAL_DISTORS,d1
  591.     beq analyse_distorsion
  592.  
  593.     bra boucle_gem_principale
  594. ************************************************************************************************
  595. show_info_about_a_file:
  596.     move.l #'*.DV',whato
  597.     move.l #'S,*.',whato+4
  598.     move.l #'LT'*65536,whato+8
  599.     lea text_infodvw,a0
  600.     bsr copy_in2_select
  601.     bsr fileselect
  602.     tst d4
  603.     beq annn
  604.  
  605.     lea params_it,a0
  606. .f:    tst.b (a0)+        ; X X X 0 ptr
  607.     bne.s .f
  608.  
  609.     cmp.l #'.LT'*256,-4(a0)
  610.     beq its_list_of_track
  611.  
  612.     FS_FIRST #$23,params_it
  613.     GET_DTA
  614.     move.l d0,a0
  615.     move.l 26(a0),taille_fich_dvw
  616.  
  617.     file_open read,params_it
  618.     tst d0
  619.     bmi annn
  620.     move.w d0,handle1
  621.  
  622.     file_read #read_info_dvw,#16,handle1
  623.     cmp.l #16,d0
  624.     bne annn2
  625.  
  626.     lea read_info_dvw,a0
  627.     cmp.l #'DVSM',dvs_header(a0)
  628.     bne annn2            ; raw data : pas de fréquence
  629.  
  630.     tst.w dvs_header+4(a0)
  631.     bne annn2            ; not supported
  632.  
  633.     move.w dvs_length(a0),length_tetos+2
  634.  
  635.     move.w #INFO_ON_FILE,d0
  636.     lea add_tree,a0
  637.     bsr get_addr_tree
  638.  
  639.     move.l add_tree,a0        ; a0
  640.     move.w #INFO_TITLE,d0
  641.     bsr get_text_add        ; a1
  642.     clr.b (a1)
  643.  
  644.     move.l add_tree,a0        ; a0
  645.     move.w #INFO_AUTHOR,d0
  646.     bsr get_text_add        ; a1
  647.     clr.b (a1)
  648.  
  649.     move.l add_tree,a0        ; a0
  650.     move.w #ADD_PACKT_YES_NO,d0
  651.     bsr get_text_add        ; a1
  652.     move.l #'NO.'*256,(a1)
  653.  
  654.     move.l #16,d7
  655.  
  656. .view_cookies:
  657.     file_read #scan_cookies,#6,handle1
  658.     cmp.l #6,d0
  659.     bne annn2
  660.  
  661.     lea scan_cookies,a0
  662.  
  663.     cmp.l #'LPKC',cookie_identify(a0)
  664.     beq.s .lpck
  665.     cmp.l #'PACK',cookie_identify(a0)
  666.     beq.s .pack
  667.     cmp.l #'TITL',cookie_identify(a0)
  668.     beq .titl
  669.     cmp.l #'AUTH',cookie_identify(a0)
  670.     beq .auth
  671.  
  672.     clr.l d0
  673.     move.w cookie_length(a0),d0
  674.     add.w d0,d7
  675.     subq.l #6,d0
  676.     file_seek #1,handle1,d0
  677.  
  678. .finish_cookie:
  679.     cmp.l length_tetos,d7
  680.     bne.s .view_cookies
  681.     bra .fincookies
  682.  
  683. .lpck:    file_read #read_dvs_header,#2,handle1
  684.     cmp.l #2,d0
  685.     bne annn2
  686.     add.l #8,d7
  687.     move.w read_dvs_header,store_lpckc    ; 8 bit pack-code
  688.     bra.s .finish_cookie
  689.  
  690. .pack:    file_seek #1,handle1,#256*2
  691.     add.l #4+2+256*2,d7
  692.     move.l add_tree,a0        ; a0
  693.     move.w #ADD_PACKT_YES_NO,d0
  694.     bsr get_text_add        ; a1
  695.     move.l #'YES'*256,(a1)
  696.     bra.s .finish_cookie
  697.  
  698. .titl:    move.l add_tree,a0        ; a0
  699.     move.w #INFO_TITLE,d0
  700.     bsr get_text_add        ; a1
  701.     file_read a1,#26,handle1
  702.     add.l #4+2+26,d7
  703.     bra .finish_cookie
  704.  
  705. .auth:    move.l add_tree,a0        ; a0
  706.     move.w #INFO_AUTHOR,d0
  707.     bsr get_text_add        ; a1
  708.     file_read a1,#26,handle1
  709.     add.l #4+2+26,d7
  710.     bra .finish_cookie
  711.  
  712. .fincookies:
  713.     file_close handle1
  714.  
  715.     lea read_info_dvw,a6
  716.  
  717.     move.l add_tree,a0        ; a0
  718.     move.w #PACKED_YES_NO,d0
  719.     bsr get_text_add        ; a1
  720.     move.l #'NO'*65536,(a1)
  721.     cmp.b #2,dvs_pack(a6)        ; 2=packé
  722.     bne.s .no
  723.     move.l #'YES'*256,(a1)
  724. .no:
  725.     move.l add_tree,a0        ; a0
  726.     move.w #LENGTH_PACK_CODE,d0
  727.     bsr get_text_add        ; a1
  728.     clr.l d0
  729.     move.w store_lpckc,d0
  730.     bsr deci2
  731.  
  732.     move.l add_tree,a0        ; a0
  733.     move.w #FREQUENZ,d0
  734.     bsr get_text_add        ; a1
  735.  
  736.     move.w dvs_freq(a6),d0
  737.     lea table_cv_freq,a0
  738.     move.w 6(a0,d0.w*8),freq_dvw+2
  739.     move.w 0(a0,d0.w*8),(a1)    ; ex. : 8.
  740.     clr.b 2(a1)
  741.  
  742.     ; 0=stéréo,1=mono
  743.     move.l add_tree,a0        ; a0
  744.     move.w #TYPE_OF_SOUND,d0
  745.     bsr get_text_add        ; a1
  746.  
  747.     move.l taille_fich_dvw,d7
  748.     clr.l d6
  749.     move.w dvs_length(a6),d6
  750.     sub.l d6,d7            ; approximation à 0.03 %
  751.  
  752.     cmp.b #1,dvs_mode(a6)        ; 1=stéréo
  753.     beq.s .stereo
  754.     move.l #'mono',(a1)
  755.     clr.b 4(a1)
  756.     bra.s .conti
  757. .stereo:    move.l #'ster',(a1)
  758.     move.w #'eo',4(a1)
  759.     clr.b 6(a1)
  760.     divu.l #2,d7
  761.  
  762. .conti:    tst.b dvs_pack(a6)        ; 2=packé, 0=non packé
  763.     bne.s .packed
  764.     divu.l #2,d7
  765. .packed:    divu.l freq_dvw,d7
  766.  
  767. same_as_before:        ; le programme pour *.LT reprend ici
  768.  
  769.     divu #60,d7
  770.     move.w d7,d6
  771.     ext.l d6        ; minutes
  772.     swap d7
  773.     ext.l d7        ; secs
  774.     save d6-d7
  775.  
  776.     move.l add_tree,a0        ; a0
  777.     move.w #MINUTES,d0
  778.     bsr get_text_add        ; a1
  779.     load d6-d7
  780.     move.l d6,d0
  781.     save d7
  782.     bsr deci2
  783.  
  784.     move.l add_tree,a0        ; a0
  785.     move.w #SECONDS,d0
  786.     bsr get_text_add        ; a1
  787.     load d7
  788.     move.l d7,d0
  789.     bsr deci2
  790.  
  791.     move #INFO_ON_FILE,d0
  792.     bsr traite_formulaire
  793.  
  794. annn:    bra boucle_gem_principale
  795. annn2:    file_close handle1
  796.     bra.s annn
  797.             ***************
  798. its_list_of_track:
  799.     bsr stop_if_running        ; on utilise son buffer (.LT)
  800.  
  801.     file_open read,params_it
  802.     move d0,d7
  803.     bmi annn
  804.  
  805.     file_read #list_of_tracks,#4096,d7
  806.     move.l d0,d6
  807.     bmi.s annn
  808.  
  809.     file_close d7
  810.  
  811.     cmp.l #4096,d6        ; liste trop grande
  812.     beq.s annn
  813.  
  814.     lea list_of_tracks,a0
  815.     clr.b (a0,d6.l)
  816.     clr.l d1            ; compte les secondes
  817.  
  818. treat_nxt:    tst.b (a0)
  819.     beq dis_was_last
  820.  
  821.     cmp.b #' ',(a0)
  822.     beq.s .zap_dis
  823.     cmp.b #lf,(a0)
  824.     beq.s .zap_dis
  825.     cmp.b #rc,(a0)
  826.     beq.s .zap_dis
  827.     cmp.b #9,(a0)    ; tab
  828.     beq.s .zap_dis
  829.     bra.s .cool
  830. .zap_dis:    lea 1(a0),a0
  831.     bra.s treat_nxt
  832.  
  833. .cool:    lea name_2_load,a1
  834.  
  835. .redo:    move.b (a0)+,d0
  836.     beq.s .end_ofl
  837.     cmp.b #' ',d0
  838.     beq.s .last
  839.     cmp.b #lf,d0
  840.     beq.s .last
  841.     cmp.b #rc,d0
  842.     beq.s .last
  843.     cmp.b #9,d0
  844.     beq.s .last
  845.     move.b d0,(a1)+
  846.     bra.s .redo
  847. .end_ofl:    lea -1(a0),a0    ; pour pointer sur le 0
  848.  
  849. .last:    clr.b (a1)+
  850.  
  851.     save a0/d1
  852.  
  853.     FS_FIRST #$23,name_2_load
  854.     GET_DTA
  855.     move.l d0,a0
  856.     move.l 26(a0),taille_fich_dvw
  857.  
  858.     file_open read,name_2_load
  859.     load a0/d1
  860.  
  861.     move.w d0,d7
  862.     bmi do_not_count
  863.  
  864.     save a0/d1
  865.  
  866.     file_read #read_info_dvw,#16,d7
  867.     save d0
  868.     file_close d7
  869.     load d0
  870.  
  871.     load a0/d1
  872.     cmp.l #16,d0
  873.     bne do_not_count
  874.  
  875.     lea read_info_dvw,a6
  876.     cmp.l #'DVSM',dvs_header(a6)
  877.     bne do_not_count
  878.     tst.w dvs_header+4(a6)
  879.     bne do_not_count
  880.  
  881.     clr.l d0
  882.     move.w dvs_freq(a6),d2
  883.     lea table_cv_freq,a1
  884.     move.w 6(a1,d2.w*8),d0
  885.  
  886.     move.l taille_fich_dvw,d7
  887.     clr.l d6
  888.     move.w dvs_length(a6),d6
  889.     sub.w d6,d7
  890.  
  891.     cmp.b #1,dvs_mode(a6)        ; 1=stéréo
  892.     bne.s .mono
  893.     divu.l #2,d7
  894. .mono:    tst.b dvs_pack(a6)        ; 2=packé, 0=non packé
  895.     bne.s .pac
  896.     divu.l #2,d7
  897. .pac:    divu.l d0,d7
  898.  
  899.     add.l d7,d1
  900.  
  901. do_not_count:
  902.     bra treat_nxt
  903.  
  904. dis_was_last:
  905.     save d1
  906.     move.w #INFO_ON_FILE,d0
  907.     lea add_tree,a0
  908.     bsr get_addr_tree
  909.  
  910.     move.l add_tree,a0        ; a0
  911.     move.w #PACKED_YES_NO,d0
  912.     bsr get_text_add        ; a1
  913.     move.l #'YES'*256,(a1)
  914.  
  915.     move.l add_tree,a0        ; a0
  916.     move.w #TYPE_OF_SOUND,d0
  917.     bsr get_text_add        ; a1
  918.     move.l #'???'*256,(a1)
  919.  
  920.     move.l add_tree,a0        ; a0
  921.     move.w #INFO_TITLE,d0
  922.     bsr get_text_add        ; a1
  923.     lea params_it,a0
  924.     move #26-1,d0
  925. .rcp:    move.b (a0)+,(a1)+
  926.     dbf d0,.rcp
  927.  
  928.     move.l add_tree,a0        ; a0
  929.     move.w #INFO_AUTHOR,d0
  930.     bsr get_text_add        ; a1
  931.     clr.b (a1)
  932.  
  933.     move.l add_tree,a0        ; a0
  934.     move.w #ADD_PACKT_YES_NO,d0
  935.     bsr get_text_add        ; a1
  936.     move.l #'???'*256,(a1)
  937.  
  938.     move.l add_tree,a0        ; a0
  939.     move.w #FREQUENZ,d0
  940.     bsr get_text_add        ; a1
  941.     move.w #'?'*256,(a1)
  942.  
  943.     move.l add_tree,a0        ; a0
  944.     move.w #LENGTH_PACK_CODE,d0
  945.     bsr get_text_add        ; a1
  946.     move.w #'8'*256,(a1)
  947.  
  948.     load d7
  949.     bra same_as_before
  950.  
  951.  BSS
  952. taille_fich_dvw:    ds.l 1
  953. length_tetos:    ds.l 1
  954. read_info_dvw:    ds.b 16        ; pour l'analyse d'un dvw
  955. scan_cookies:    ds.b 4+2
  956. header_dvw:        ds.l 1
  957. freq_dvw:        ds.l 1        ; fréquence
  958. store_lpckc:    ds.w 1        ; 8 bit pack-code à priori
  959.  TEXT
  960. ************************************************************************************************
  961.  
  962. choose_table:
  963.     move.l #'*.TA',whato
  964.     move.w #'B'*256,whato+4
  965.     lea text_table,a0
  966.     bsr copy_in2_select
  967.     bsr fileselect
  968.     tst d4
  969.     beq ann
  970.  
  971.     file_open read,params_it
  972.     tst d0
  973.     bmi ann
  974.     move.w d0,handle1
  975.  
  976. conv_auto4:    file_read #table_dvswax,#256*2,handle1
  977.     move.l d0,d7
  978.  
  979.     file_close handle1
  980.     cmp.l #256*2,d7
  981.     bne .pas_c
  982.  
  983.     cmp.w #$8000,table_dvswax
  984.     bne .pas_c
  985.     cmp.w #$0000,table_dvswax+128*2
  986.     bne .pas_c
  987.     cmp.w #$7fff,table_dvswax+255*2
  988.     bne .pas_c
  989.  
  990.     bra.s ann
  991.  
  992. .pas_c:    lea original_table_dvswax,a0
  993.     lea table_dvswax,a1
  994.     move #256-1,d0
  995. .default:    move.w (a0)+,(a1)+
  996.     dbf d0,.default
  997.  
  998.     lea alert_table,a0
  999.     bsr alert_box
  1000.  
  1001. ann:    bra boucle_gem_principale
  1002.     
  1003.         ********** Analyses **********
  1004. TAILLE_BUFF_TEMP=1024*128
  1005.  
  1006. analyse_distorsion:
  1007.     move.l #'*.TR',whato
  1008.     move.w #'K'*256,whato+4
  1009.     lea text_dist1,a0
  1010.     bsr copy_in2_select
  1011.     bsr fileselect
  1012.     tst d4
  1013.     beq .annule_dist
  1014.  
  1015.     bsr stop_if_running        ; car je fais test_if_wax_info_present2
  1016.  
  1017.     lea params_it,a0
  1018.     bsr test_if_wax_info_present2
  1019.     file_open read,params_it
  1020.     move.w d0,handle1
  1021.     bmi .annule_dist
  1022.     file_seek #0,handle1,header
  1023.  
  1024.     lea text_dist2,a0
  1025.     bsr copy_in2_select
  1026.     bsr fileselect
  1027.     tst d4
  1028.     beq .annule_dist1
  1029.  
  1030.     lea params_it,a0
  1031.     bsr test_if_wax_info_present2
  1032.     file_open read,params_it
  1033.     move.w d0,handle2
  1034.     bmi .annule_dist1
  1035.     file_seek #0,handle2,header
  1036.  
  1037.     move.l #TAILLE_BUFF_TEMP,d0
  1038.     bsr allocate_dis_memory
  1039.     bmi .annule_dist2
  1040.     move.l d0,memory_pointer
  1041.  
  1042. .analyse_again:
  1043.     file_read memory_pointer,#TAILLE_BUFF_TEMP/2,handle1
  1044.     cmp.l #TAILLE_BUFF_TEMP/2,d0
  1045.     bne .annule_dist3
  1046.     move.l memory_pointer,d0
  1047.     add.l #TAILLE_BUFF_TEMP/2,d0
  1048.     file_read d0,#TAILLE_BUFF_TEMP/2,handle2
  1049.     cmp.l #TAILLE_BUFF_TEMP/2,d0
  1050.     bne .annule_dist3
  1051.  
  1052.     move.l memory_pointer,a0
  1053.     move.l memory_pointer,a1
  1054.     add.l #TAILLE_BUFF_TEMP/2,a1
  1055.     fmove.w #0,fp0        ; somme des deltas
  1056.     fmove.w #0,fp7        ; compteur
  1057.  
  1058. .redo:    move.w (a0)+,d6
  1059.     move.w (a1)+,d7
  1060.     ext.l d6
  1061.     ext.l d7
  1062.     beq.s .zero
  1063.  
  1064.     sub.l d7,d6
  1065.     fmove.l d6,fp1
  1066.     fmove.l d7,fp2
  1067.     fabs.x fp1
  1068.     fabs.x fp2
  1069.     fdiv.x fp2,fp1
  1070.     fadd.x fp1,fp0
  1071.     fadd.x #1,fp7
  1072.  
  1073. .zero:    subq.l #2,d0
  1074.     bgt.s .redo
  1075.  
  1076.     fdiv.x fp7,fp0
  1077.     fmul.x #1000,fp0
  1078.  
  1079.     move.w #DISTORSION,d0
  1080.     lea add_tree,a0
  1081.     bsr get_addr_tree
  1082.  
  1083.     move.l add_tree,a0        ; a0
  1084.     move.w #DIST_PER_MILE,d0
  1085.     bsr get_text_add        ; a1
  1086.     fmove.l fp0,d0
  1087.     bsr deci2
  1088.  
  1089.     move #DISTORSION,d0
  1090.     bsr traite_formulaire
  1091.  
  1092.     cmp.w #DMORE,d0
  1093.     beq .analyse_again
  1094.  
  1095. .annule_dist3:
  1096.     move.l memory_pointer,d0
  1097.     bsr desallocate_dis_memory
  1098. .annule_dist2:
  1099.     file_close handle2
  1100. .annule_dist1:
  1101.     file_close handle1
  1102. .annule_dist:
  1103.     bra boucle_gem_principale
  1104.     
  1105.  
  1106. DEMI_TAILLE=65536*2
  1107.  
  1108. analyse_trk:move.l #'*.TR',whato
  1109.     move.w #'K'*256,whato+4
  1110.     lea text_analyse,a0
  1111.     bsr copy_in2_select
  1112.     bsr fileselect
  1113.     tst d4
  1114.     beq .annule_ana
  1115.  
  1116.     bsr stop_if_running
  1117.  
  1118.     lea params_it,a0
  1119.     bsr test_if_wax_info_present2
  1120.     file_open read,params_it
  1121.     move.w d0,handle1
  1122.     bmi .annule_ana
  1123.     file_seek #0,handle1,header
  1124.  
  1125.     move.l #DEMI_TAILLE*2,d0
  1126.     bsr allocate_dis_memory
  1127.     bmi .annule_ana2
  1128.     move.l d0,memory_pointer
  1129.  
  1130. .analyse_again:
  1131.     file_read memory_pointer,#DEMI_TAILLE,handle1
  1132.     cmp.l #DEMI_TAILLE,d0
  1133.     bne .annule_ana3
  1134.  
  1135.     move.l memory_pointer,a0
  1136.     add.l #DEMI_TAILLE,a0
  1137.     move.l #DEMI_TAILLE/4,d0
  1138. .clr:    clr.l (a0)+
  1139.     subq.l #1,d0
  1140.     bne.s .clr
  1141.  
  1142.     move.l memory_pointer,a0
  1143.     move.l memory_pointer,a1
  1144.     add.l #DEMI_TAILLE,a1
  1145.     move.l a1,a6        ; ptr + 1/2 buufer
  1146.     move.l a1,a5
  1147.     add.l #DEMI_TAILLE,a5        ; ptr fin buffer
  1148.     move.w (a0)+,d0
  1149.     ext.l d0
  1150.     move.w (a0)+,d1
  1151.     ext.l d1
  1152. .redo:    cmp.l a6,a0
  1153.     bge.s .fini
  1154.     move.l d0,d2
  1155.     move.w (a0)+,d0
  1156.     ext.l d0
  1157.     sub.l d0,d2
  1158.     bpl.s .pos1
  1159.     neg.l d2
  1160. .pos1:    move.l d1,d3
  1161.     move.w (a0)+,d1
  1162.     ext.l d1
  1163.     sub.l d1,d3
  1164.     bpl.s .pos2
  1165.     neg.l d3
  1166. .pos2:    addq.w #1,(a1,d2.l*2)
  1167.     addq.w #1,(a1,d3.l*2)
  1168.     bra.s .redo
  1169.  
  1170. .fini:
  1171.  
  1172.     move.w #ANALYSE,d0
  1173.     lea add_tree,a0
  1174.     bsr get_addr_tree
  1175.     move.l add_tree,a0        ; a0
  1176.  
  1177.     move.w #ABS_MIN_DELTA,d0
  1178.     bsr get_text_add        ; a1
  1179.     move.l a6,a2
  1180. .ze:    tst.w (a2)+
  1181.     beq.s .ze
  1182.     lea -2(a2),a2
  1183.     sub.l a6,a2
  1184.     move.l a2,d0
  1185.     lsr.l #1,d0
  1186.     bsr deci2
  1187.  
  1188.     move.w #ABS_MAX_DELTA,d0
  1189.     bsr get_text_add        ; a1
  1190.     move.l a5,a2
  1191. .ze0:    tst.w -(a2)
  1192.     beq.s .ze0
  1193.     sub.l a6,a2
  1194.     move.l a2,d0
  1195.     lsr.l #1,d0
  1196.     bsr deci2
  1197.  
  1198.     move.w #AVERAGE_DELTA,d0
  1199.     bsr get_text_add
  1200.     move.l a6,a2
  1201.     fmove.w #0,fp0        ; index
  1202.     fmove.w #0,fp2        ; somme
  1203.     clr.l d0
  1204.  
  1205. .redoo:    cmp.l a5,a2
  1206.     beq.s .f
  1207.     move.w (a2)+,d0        ; jusqu'à 65535
  1208.     fmove.l d0,fp1
  1209.     fmul.x fp0,fp1
  1210.     fadd.x fp1,fp2
  1211.     fadd.x #1,fp0
  1212.     bra.s .redoo
  1213. .f:    fmove.l #DEMI_TAILLE/2,fp0    ; nombre d'échantillons traité
  1214.     fdiv.x fp0,fp2
  1215.     fmove.l fp2,d0
  1216.     bsr deci2
  1217.  
  1218.     move.w #DELTA_VARIANCE,d0
  1219.     bsr get_text_add
  1220.     move.l a6,a2
  1221.     ;fp2: moyenne
  1222.     fmove.w #0,fp0        ; index (delta 0 -> 65535)
  1223.     fmove.w #0,fp3        ; somme des carrés
  1224.     clr.l d0
  1225.  
  1226. .redooo:    cmp.l a5,a2
  1227.     beq.s .ff
  1228.     move.w (a2)+,d0        ; jusqu'à 65535
  1229.     fmove.l d0,fp1        ; nombre
  1230.     
  1231.     fmove.x fp2,fp4        ; moy
  1232.     fsub.x fp0,fp4        ; -val actuelle
  1233.     fmul.x fp4,fp4        ; ^2
  1234.     fmul.x fp1,fp4        ; * nb val actuelle
  1235.     
  1236.     fadd.x fp4,fp3
  1237.     fadd.x #1,fp0
  1238.     bra.s .redooo
  1239. .ff:    fmove.l #DEMI_TAILLE/2,fp0    ; nombre d'échantillons traités
  1240.     fdiv.x fp0,fp3
  1241.     fsqrt.x fp3
  1242.     fmove.l fp3,d0
  1243.     bsr deci2
  1244.  
  1245.     move #ANALYSE,d0
  1246.     bsr traite_formulaire
  1247.  
  1248.     cmp.w #MORE,d0
  1249.     beq .analyse_again
  1250.  
  1251. .annule_ana3:
  1252.     move.l memory_pointer,d0
  1253.     bsr desallocate_dis_memory
  1254.  
  1255. .annule_ana2:
  1256.     file_close handle1
  1257.  
  1258. .annule_ana:bra boucle_gem_principale
  1259.     
  1260.         ******** Conversions *********
  1261.  
  1262.     include convert.s
  1263.  
  1264.         ******** Loop mode ********
  1265. loop_file:    tst loop
  1266.     beq.s .null
  1267.     move #0,loop
  1268.     move #FILES_LOOP,d0
  1269.     moveq #0,d1
  1270.     bsr check_menu
  1271.     bra boucle_gem_principale
  1272. .null    move #1,loop
  1273.     move #FILES_LOOP,d0
  1274.     moveq #1,d1
  1275.     bsr check_menu
  1276.     bra boucle_gem_principale
  1277.  
  1278.         ******* Load file sélectrix *********
  1279. load_file:
  1280.     tst.l play_list_ptr
  1281.     bne copy_next_in_list
  1282. ask_selctor:
  1283.  
  1284.     tst.l are_there_more        ; test avant sélecteur pas logique
  1285.     bne.s .more            ; mais : si Multiple desktop select sous MiNT & pas selectrix
  1286.  
  1287.     tst.l sltr_adress        ; sélectrix is here ?
  1288.     beq.s no_trix
  1289.  
  1290.     move.l sltr_communication_word,a0
  1291.     move.w #3,(a0)
  1292.     move.l sltr_out_counter,a0
  1293.     move.w #256,(a0)
  1294.     move.l sltr_out_pointer,a0
  1295.     move.l #return_more_names,(a0)
  1296.     bra.s no_trix
  1297.  
  1298. .more:    move.l are_there_more,a0
  1299. troc2:    lea params_it,a1
  1300. cpp:    move.b (a0)+,(a1)+
  1301.     tst.b -1(a1)
  1302.     beq.s .that_was_last
  1303.     cmp.b #' ',-1(a1)
  1304.     bne.s cpp
  1305.     clr.b -1(a1)
  1306.     move.l a0,are_there_more
  1307.     bra no_selector
  1308. .that_was_last:
  1309.     clr.l are_there_more
  1310.     bra.s no_selector
  1311. no_trix:
  1312.  
  1313.  
  1314.     move.l #'*.TR',whato
  1315.     tst.l sltr_adress
  1316.     beq.s .no_trix3
  1317.     move.l #'K,*.',whato+4
  1318.     move.l #'DVS,',whato+8        ; *.TRK,*.DVS,*.LT 0
  1319.     move.l #'*.LT',whato+12
  1320.     move.b #0,whato+16
  1321.     bra.s .zap
  1322. .no_trix3:    move.w #'K'*256,whato+4
  1323. .zap:
  1324.     lea texte_fsel,a0        ; 35 chars max.
  1325.     bsr copy_in2_select
  1326.     clr.b return_more_names        ; s'il choisi 1 seul fichier
  1327.     bsr fileselect
  1328.     cmp.w #1,d4
  1329.     bne.s f_i_n
  1330.  
  1331.     tst.l sltr_adress
  1332.     beq.s .no_trix2
  1333.     tst.b return_more_names
  1334.     beq.s .no_trix2        ; aucune sélection multiple (*.S par ex)
  1335.     move.l #return_more_names,a0
  1336.     bra troc2
  1337. .no_trix2:
  1338.     tst.b params_it        ; le mec tappe enter
  1339.     beq.s f_i_n
  1340.  
  1341. no_selector:
  1342.  
  1343.     bsr stop_if_running
  1344.  
  1345.     lea params_it,a0
  1346.     lea name_2_load,a1
  1347. .cp:    move.b (a0)+,(a1)+
  1348.     tst.b -1(a1)
  1349.     bne.s .cp
  1350.  
  1351. load_file2:    bsr test_if_itsa_play_list
  1352.     tst d7
  1353.     bpl load_file
  1354.  
  1355. load_it_now:
  1356.  
  1357.     bsr test_if_wax_info_present
  1358.  
  1359. reload_the_same:            ; pour loop
  1360.  
  1361.     bsr init_d2d
  1362.     tst d7
  1363.     bmi.s error_occured_at_init
  1364.     bsr play_d2d
  1365.  
  1366. f_i_n:    bra boucle_gem_principale
  1367.  
  1368.         ******
  1369.  
  1370. error_occured_at_init:
  1371.     move #SOUND_SEMAPHORE,d0
  1372.  
  1373.     cmp #NOT_ENOUGH_MEMORY,d7
  1374.     bne.s .pas1
  1375.     move #MEMORY_PROBLEM,d0
  1376.     bra.s .aff
  1377.  
  1378. .pas1:    cmp #BAD_DVW_HEADER,d7
  1379.     bne.s .aff
  1380.     move #BAD_DVS_HEADER,d0
  1381.  
  1382. .aff:    bsr traite_formulaire
  1383.  
  1384.     bra boucle_gem_principale
  1385.  
  1386.  
  1387.         ******* List of Tracks *******
  1388. test_if_itsa_play_list:
  1389.     lea name_2_load,a0
  1390.  
  1391.     lea name_for_wax,a1
  1392. .cp:    move.b (a0)+,(a1)+
  1393.     tst.b -1(a1)
  1394.     bne.s .cp
  1395.     lea -1(a1),a1
  1396.  
  1397.     cmp.l #name_for_wax+4,a1
  1398.     ble .return
  1399.  
  1400.     cmp.l #'.LT'*256,-3(a1)
  1401.     bne.s .return
  1402.  
  1403.     file_open read,name_for_wax    ; name for wax : sert aussi de buffer
  1404.     move d0,d7
  1405.     bmi .return
  1406.  
  1407.     file_read #list_of_tracks,#4096,d7
  1408.     move.l d0,d6
  1409.  
  1410.     file_close d7
  1411.  
  1412.     cmp.l #4096,d6        ; liste trop grande
  1413.     beq.s .return
  1414.  
  1415.     lea list_of_tracks,a0
  1416.     clr.b (a0,d6.l)
  1417.  
  1418.     move.l a0,play_list_ptr
  1419.  
  1420.     clr d7
  1421.     rts    
  1422.  
  1423. .return:    moveq #-1,d7
  1424.     rts
  1425.  
  1426.     bra.s .return
  1427.  
  1428. copy_next_in_list:
  1429.     move.l play_list_ptr,a0
  1430.  
  1431. .next:    tst.b (a0)
  1432.     beq.s .fin
  1433.  
  1434.     cmp.b #' ',(a0)
  1435.     beq.s .zap_dis
  1436.     cmp.b #lf,(a0)
  1437.     beq.s .zap_dis
  1438.     cmp.b #rc,(a0)
  1439.     beq.s .zap_dis
  1440.     cmp.b #9,(a0)    ; tab
  1441.     beq.s .zap_dis
  1442.     bra.s .cool
  1443. .zap_dis:    lea 1(a0),a0
  1444.     bra.s .next
  1445.  
  1446. .cool:    lea name_2_load,a1
  1447.  
  1448. .redo:    move.b (a0)+,d0
  1449.     beq.s .end_ofl
  1450.     cmp.b #' ',d0
  1451.     beq.s .last
  1452.     cmp.b #lf,d0
  1453.     beq.s .last
  1454.     cmp.b #rc,d0
  1455.     beq.s .last
  1456.     cmp.b #9,d0
  1457.     beq.s .last
  1458.     move.b d0,(a1)+
  1459.     bra.s .redo
  1460.  
  1461. .last:    clr.b (a1)+
  1462.     move.l a0,play_list_ptr
  1463.     bsr stop_if_running
  1464.     bra load_it_now
  1465.  
  1466. .end_ofl:    clr.l play_list_ptr
  1467.     bra load_it_now
  1468.  
  1469. .fin:    clr.l play_list_ptr
  1470.     bra ask_selctor
  1471.         ******* Format WAX *******
  1472.  
  1473. test_if_wax_info_present:
  1474.     lea name_2_load,a0
  1475.  
  1476. test_if_wax_info_present2:
  1477.  
  1478.     clr wax_info_present
  1479.     ;move.w #1,which_rout    ; routine par défaut: ne pas changer
  1480.     clr.l header    ; si jamais le .WAX n'existe pas
  1481.     ;move #1,replay_in_psst    ; il faut garder les prefs en cours
  1482.     ;move #20,nb_ms
  1483.  
  1484.     lea name_for_wax,a1    ; met un .WAX à la fin du nom
  1485. .cp:    move.b (a0)+,(a1)+
  1486.     tst.b -1(a1)
  1487.     bne.s .cp
  1488.  
  1489. .again:    move.b -(a1),d0
  1490.     cmp.b #'.',d0
  1491.     beq.s .foundp
  1492.     cmp.l #name_for_wax,a1
  1493.     beq.s .noa
  1494.     cmp.b #'\',d0
  1495.     bne.s .again
  1496. .noa:
  1497. .f0:    tst.b (a1)+
  1498.     bne.s .f0
  1499.     move.l #'.WAX',-1(a1)
  1500.     clr.b 3(a1)
  1501.     bra.s .got_name
  1502.  
  1503. .foundp:    move.l #'WAX'*256,1(a1)
  1504.  
  1505. .got_name:    file_open read,name_for_wax    ; name for wax : set aussi de buffer
  1506.     move d0,d7
  1507.     bmi pacool
  1508.  
  1509.     file_read #name_for_wax,#256,d7
  1510.     lea name_for_wax,a1
  1511.     add.l d0,a1
  1512.     save a1
  1513.     file_close d7
  1514.     load a1
  1515.  
  1516.     move #1,wax_info_present
  1517.     lea name_for_wax,a0
  1518.  
  1519. redox:    cmp.l a0,a1
  1520.     ble pacool
  1521.  
  1522.     cmp.b #';',(a0)
  1523.     bne.s .paspv
  1524. .notf:    cmp.l a0,a1
  1525.     ble pacool
  1526.     move.b (a0)+,d0
  1527.     cmp.b #lf,d0
  1528.     bne.s .notf
  1529.     bra.s redox
  1530.  
  1531. .paspv:    cmp.l #'freq',(a0)        ; Fréquence
  1532.     bne.s .pasfreq
  1533.     lea 5(a0),a0        ; après le =
  1534.     
  1535.     lea table_cv_freq,a2
  1536. .f1:    tst.w (a2)
  1537.     beq redox 
  1538.     move.w (a0),d0
  1539.     cmp.w (a2),d0
  1540.     beq.s .f
  1541.     lea 8(a2),a2
  1542.     bra.s .f1
  1543. .f:    move.w 2(a2),d0
  1544.     move.b d0,frequency_for_play
  1545.     move.w 4(a2),d6        ; menu check
  1546.     save a0/a1
  1547.     bsr menu_freq_check2
  1548.     load a0/a1
  1549.     bra redox
  1550.  
  1551. .pasfreq:    cmp.l #'form',(a0)        ; Format
  1552.     bne.s .pasform
  1553.     lea 5(a0),a0        ; après le =
  1554.  
  1555.     cmp.l #'16bs',(a0)
  1556.     bne.s .pa16bs
  1557.     move.w #1,d0
  1558.     move #METHOD_1,d1
  1559.     bra.s .set_it
  1560. .pa16bs:    cmp.l #'16bm',(a0)
  1561.     bne.s .pa16bm
  1562.     move.w #2,d0
  1563.     move #METHOD_2,d1
  1564.     bra.s .set_it
  1565. .pa16bm:    cmp.l #'dvsm',(a0)
  1566.     bne redox
  1567.     move.w #3,d0
  1568.     move #METHOD_3,d1
  1569. .set_it:    move.w d0,which_rout
  1570.     save a0/a1
  1571.     bsr check_method
  1572.     load a0/a1
  1573.     bra redox
  1574.  
  1575. .pasform:    cmp.l #'head',(a0)        ; Header length
  1576.     bne.s .pashead
  1577.     lea 5(a0),a0        ; après le =
  1578.  
  1579.     clr.l d1
  1580. .redo:    clr d0
  1581.     move.b (a0)+,d0
  1582.     cmp.b #'0',d0
  1583.     blt.s .finihed
  1584.     cmp.b #'9',d0
  1585.     bgt.s .finihed
  1586.     mulu.l #10,d1
  1587.     sub.b #'0',d0
  1588.     ext.l d0
  1589.     add.l d0,d1
  1590.     bra.s .redo
  1591.     
  1592. .finihed:    move.l d1,header
  1593.     bra redox
  1594.  
  1595. .pashead:    cmp.l #'dlay',(a0)        ; Delay in ms
  1596.     bne.s .pasdlay
  1597.     lea 5(a0),a0        ; après le =
  1598.  
  1599.     clr.l d1
  1600.     move.l a0,a2
  1601. .redoo:    clr d0
  1602.     move.b (a0)+,d0
  1603.     cmp.b #'-',d0
  1604.     beq.s .redoo
  1605.     cmp.b #'0',d0
  1606.     blt.s .finihedd
  1607.     cmp.b #'9',d0
  1608.     bgt.s .finihedd
  1609.     mulu.l #10,d1
  1610.     sub.b #'0',d0
  1611.     ext.l d0
  1612.     add.l d0,d1
  1613.     bra.s .redoo
  1614.  
  1615. .finihedd:    cmp.b #'-',(a2)
  1616.     bne.s .pos
  1617.     neg d1
  1618. .pos:    cmp.w #99,d1
  1619.     bgt.s .passtk
  1620.     cmp.w #-99,d1
  1621.     blt.s .passtk
  1622.     move.w d1,nb_ms
  1623. .passtk:    bra redox
  1624.  
  1625. .pasdlay:    cmp.l #'ster',(a0)        ; Replay in ps-st if possible
  1626.     bne.s .passter
  1627.     lea 5(a0),a0        ; après le =
  1628.  
  1629.     clr replay_in_psst
  1630.     cmp.l #'YES.',(a0)
  1631.     bne.s .past
  1632.     move #1,replay_in_psst
  1633. .past:    move #METHOD_4,d0
  1634.     move replay_in_psst,d1
  1635.     save a0/a1
  1636.     bsr check_menu
  1637.     load a0/a1
  1638.  
  1639.     bra redox
  1640.  
  1641. .passter:
  1642.     lea 1(a0),a0
  1643.     bra redox
  1644.  
  1645. pacool:    rts
  1646.         ******* Fin Format WAX *******
  1647.  
  1648. fin:    bsr stop_if_running
  1649.     restore_prg
  1650.  
  1651. menu_freq_check:
  1652.     tst sample_playing        ; sera updaté de toute façon
  1653.     beq.s menu_freq_check2        ; à l'init 2 play
  1654.  
  1655.     save d1            ; d6=menu
  1656.     move.w #1,-(sp)        ; no hand shaking
  1657.     clr d0
  1658.     move.b frequency_for_play,d0
  1659.     move.w d0,-(sp)
  1660.     move.w which_clock,-(sp)    ; 0=interne 25 HHz,1=externe
  1661.     move.w #8,-(sp)        ; destination : DAC
  1662.     move.w #0,-(sp)        ; source : DMA
  1663.     appel xbios,139,12
  1664.     load d1
  1665.  
  1666. menu_freq_check2:            ; set menu but not dma freq
  1667.     save d1
  1668.     move previous_check1,d0
  1669.     move #0,d1
  1670.     bsr check_menu        ; uncheck
  1671.     move d6,d0
  1672.     move d6,previous_check1
  1673.     move #1,d1
  1674.     bsr check_menu        ; check
  1675.  
  1676.     load d1
  1677.     rts
  1678.  
  1679. check_method:
  1680.     save d1
  1681.     move previous_check2,d0
  1682.     move #0,d1
  1683.     bsr check_menu
  1684.     move.l (sp),d1
  1685.     move d1,d0
  1686.     move d0,previous_check2
  1687.     moveq #1,d1
  1688.     bsr check_menu
  1689.     load d1
  1690.     rts    
  1691.  BSS
  1692. frequ:    ds.b 1
  1693.  even
  1694.  TEXT
  1695. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;    
  1696. TAILLE_MAGIC=5*6*7*8*2    ; multiple de 5...8=3360 (1/10 s à 33KHz mono packé)
  1697. NBR_BUFF=4        ; attention nombre minimal : 4 (pour conversions)!!
  1698. LENGTH_REPLAY=TAILLE_MAGIC*32    ; ?????? octets
  1699.  
  1700.     ; pour qu'au chargement on charge juste 1 block en mono
  1701.     ; i.e. TAILLE_MAGIC+2
  1702.  
  1703.     include mod_dpro.s
  1704.  
  1705. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;    
  1706.     section DATA
  1707.  
  1708. text_mono1:        dc.b 'Stereo 16-bit file to convert mono :',0
  1709. text_mono2:        dc.b 'Select Mono destination file :',0
  1710.  
  1711. text_two1:        dc.b 'Stereo 16-bit file to convert L+R :',0
  1712. text_two2:        dc.b 'Mono 16-bit file for Left chanel :',0
  1713. text_two3:        dc.b 'Mono 16-bit file for Right chanel :',0
  1714.  
  1715. text_stereo1:    dc.b 'Select 16-bit Mono source file :',0
  1716. text_stereo2:    dc.b 'Select Stereo 16-bit file :',0
  1717.  
  1718. *text_dvs1:        dc.b 'Select 16-bit DVSM source file :',0
  1719. *text_dvs2:        dc.b 'Destination Stereo 16-bit file :',0
  1720. text_dvsw1:        dc.b 'Select 16-bit TRK source file :',0
  1721. text_dvsw2:        dc.b 'Destination file (16-bit DVS):',0
  1722. text_dvsw3:        dc.b 'Source file (16-bit DVS):',0
  1723. text_dvsw4:        dc.b 'Destination 16-bit TRK file :',0
  1724.  
  1725. text_avr1:        dc.b 'Audio Visual Research file :',0
  1726. text_avr2:        dc.b 'Enter destination 16-bit file :',0
  1727.  
  1728. text_analyse:    dc.b 'Select stereo file to analyse :',0
  1729. text_dist1:        dc.b 'Select first Track (TRK no header):',0
  1730. text_dist2:        dc.b 'Select track to compare to :',0
  1731. text_table:        dc.b 'Choose a 256*2 bytes table :',0
  1732. alert_table:    dc.b "[3][There is a|problem with|your table !|setting default][OK]",0
  1733. text_infodvw:    dc.b 'Choose DVS file to get info about :',0
  1734.  
  1735. *alert_accclose:    dc.b "[3][I've received an|ACC_CLOSE event,|shall I close|or continue to play ?][CONTINUE|STOP]",0
  1736.  even
  1737.  
  1738. original_table_dvswax:
  1739.     incbin dvswax2.tab
  1740.  
  1741. conversion:    dc.w $1709,FILES_INFO
  1742.     dc.w $1e11,FILES_QUIT
  1743. *    dc.w $260c,FILES_LOAD        ; ^L
  1744.     dc.w $180f,FILES_LOAD        ; ^O
  1745.     dc.w $1f13,FILES_STOP
  1746.     dc.w $0001,SPECIAL_ANALYSE
  1747.     dc.w $0003,SPECIAL_DISTORS
  1748.     dc.w $6d31,FREQUENCY_1
  1749.     dc.w $6e32,FREQUENCY_2
  1750.     dc.w $6f33,FREQUENCY_3
  1751.     dc.w $6a34,FREQUENCY_4
  1752.     dc.w $6b35,FREQUENCY_5
  1753.     dc.w $6c36,FREQUENCY_6
  1754.     dc.w $6737,FREQUENCY_7
  1755.     dc.w $6838,FREQUENCY_8
  1756.     dc.w $6839,FREQUENCY_9
  1757.     dc.w $6830,FREQUENCY_0
  1758.     dc.w $3b00,METHOD_1
  1759.     dc.w $3c00,METHOD_2
  1760.     dc.w $3d00,METHOD_3
  1761.     dc.w $3e00,METHOD_4
  1762.     dc.l 0
  1763.  
  1764. table_cv_freq:
  1765.     dc.w '8.',freq8,FREQUENCY_1,8195
  1766.     dc.w '10',freq10,FREQUENCY_2,9834
  1767.     dc.w '12',freq12,FREQUENCY_3,12292
  1768.     dc.w '16',freq16,FREQUENCY_4,16490
  1769.     dc.w '20',freq20,FREQUENCY_5,20770
  1770.     dc.w '25',freq25,FREQUENCY_6,24585
  1771.     dc.w '33',freq33,FREQUENCY_7,32880
  1772.     dc.w '49',freq49,FREQUENCY_8,49170
  1773.     dc.w 0
  1774.  
  1775. name_rsc:
  1776.     ifeq WHO*(WHO-1)
  1777.     dc.b 'd:\assemble\sources.wax\direct4d.pro\wd2d_pro.rsc',0
  1778.     endc
  1779.     ifeq (WHO-2)
  1780.     dc.b 'd:\devpac\source\genuwax\direct4d\wd2d_pro.rsc',0
  1781.     endc
  1782.  
  1783. texte_fsel:    dc.b 'Select a 16-bit track :',0
  1784.  
  1785. string_acc:    dc.b '  Wax D2D Pro  ',0
  1786. register_name:dc.b 'WD2D_PRO',0
  1787.  even
  1788.  
  1789.     section BSS
  1790. handle1:        ds.w 1
  1791. handle2:        ds.w 1
  1792. handle3:        ds.w 1        ; ils doivent se suivre
  1793. memory_pointer:    ds.l 1        ; pour toutes les conversions
  1794.  
  1795. previous_check1:    ds.w 1        ; frequency
  1796. previous_check2:    ds.w 1        ; what method
  1797.  
  1798. wax_info_present:    ds.w 1
  1799. name_for_wax:    ds.b 256
  1800. table_dvswax:    ds.w 256        ; table qui sert pour packer
  1801.  
  1802. play_list_ptr:    ds.l 1        ; pour la liste .LT
  1803. list_of_tracks:    ds.b 4096        ; sert pour info & replay
  1804.  
  1805. are_there_more:    ds.l 1        ; pour sélectrix
  1806. return_more_names:    ds.b (8+1+3+1)*256
  1807.  
  1808. command_line:    ds.l 1
  1809. acc_number:        ds.w 1        ; ne sert à rien ... à priori
  1810. store_msg:        ds.b 256        ; pour les messages envoyés par appl.
  1811.  
  1812.     rsreset
  1813. dvs_header:        rs.b 6    ; DVSM\0\0
  1814. dvs_length:        rs.w 1    ; distance of the sound data from the start of the file.
  1815. dvs_freq:        rs.w 1    ; 0-7 : allowed CODEC frequencies (0: 8kHz ...  7: 49kHz)
  1816. dvs_pack:        rs.b 1    ; 0=not packed,2=DVS pack,4=voice pack
  1817. dvs_mode:        rs.b 1    ; 0=stéréo 8bit / 1=stéréo 16 bit / 2=mono 8bit / 3=mono 16 bit
  1818. dvs_block_length:    rs.l 1
  1819.  
  1820.     rsreset
  1821. cookie_identify:    rs.l 1
  1822. cookie_length:    rs.w 1
  1823. cookie_data:
  1824.  
  1825.     END
  1826.  
  1827. cookie    Lenght of the data    Usage
  1828. -----------------------------------------------------------------------------------------
  1829. 'LPKC'    1 word        length of pack code in bits (8 -> 1)
  1830.  
  1831. 'TITL'    26 bytes        Title of the song
  1832.  
  1833. 'AUTH'    26 bytes        Author of the song
  1834.  
  1835. 'CLCK'    1 word         0: intern clock, 1: extern CD, 2: extern DAT
  1836.  
  1837. 'PEAK'    4 byte        one word for the left and right channel containing the
  1838.             highest sample value
  1839.  
  1840. 'DSPE'    x bytes        DSP program (soundeffect !!) in binary format
  1841.  
  1842. 'PARA'    x bytes        x parameters for the sound effect. NOT before the 'DSPE'
  1843.             block!
  1844.  
  1845. 'PACK'    128 or 8 bytes    Deltapack table for the distance values. Used instead of
  1846.             the standard table (see below).
  1847.  
  1848. 'INFO'    x bytes        info text (e.g. full title)
  1849.  
  1850. Not use in WinRec (by now)
  1851.  
  1852. 'KARA'    x Bytes        karaoke text (see below)
  1853.  
  1854.  
  1855. The maximal header length (all blocks together) is limited to 65535 Bytes.
  1856. Every programm should parse the blocks, and decide to use them or not.
  1857.  
  1858. karaoke text format
  1859. -------------------
  1860.     long cookie='KARA'
  1861.     int len
  1862.     int textlen
  1863.  
  1864. followed by the text ('textlen' bytes) in standard ASCII format. After this the extension included
  1865. a measure table, with a long word (4 byte) for every word in the text. The long word contains
  1866. the time distance to the next word in 1/sampling frequency
  1867.